using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class BOD_BOD_CLASE : PaginaBaseKCG 
{
    protected void Page_Load(object sender, EventArgs e)
    {

        string strBod_Clase_Id = Request.QueryString["Bod_Clase_Id"];
        if (!string.IsNullOrEmpty(strBod_Clase_Id))
        {
            AsignarParametrosDataSourceDeatailsView(strBod_Clase_Id);
            Fv.DefaultMode = FormViewMode.ReadOnly;
        }

        base.Page_Load(sender, e);
        cargarBotones();
        Fv.DataBound += new EventHandler(Fv_Boton);
    }

    void Fv_Boton(object sender, EventArgs e)
    {
        boton_clase();
    }

    private void boton_clase()
    {
        if (Fv.CurrentMode == FormViewMode.Insert)
        {
            BtnAtributo.Enabled = false;
        }
        else
            if (Fv.CurrentMode == FormViewMode.Edit || Fv.CurrentMode == FormViewMode.ReadOnly)
            {
                BtnAtributo.Enabled = true;
            }        
    }

    protected override CheckBox CbInsertarMemoria
    {
        get { return null; }
    }

    protected override Type TipoObjeto
    {
        get { return typeof(global::Bod_Clase); }
    }

    protected override GridView Gv
    {
        get { return gvbod_clase; }
    }

    protected override FormView Fv
    {
        get { return fvbod_clase; }
    }

    protected override ObjectDataSource OdsGv
    {
        get { return odsgvbod_clase; }
    }

    protected override ObjectDataSource OdsDv
    {
        get { return odsfvbod_clase; }
    }

    protected override Button BResponderZoom
    {
        get { return Seleccionar; }
    }

    protected override Button BRegreso
    {
        get { return Atras; }
    }

    protected override Koala.KoalaWebControls.KFiltro KftFiltro
    {
        get { return kftFiltro; }
    }
    protected override string Contenedor
    {
        get { return "BOD_CLASE"; }
    }

    protected void nav_Siguiente(object sender, EventArgs e)
    {
        Gv_SelectedIndexChanged(sender, e);
    }
    private void cargarBotones()
    {
        BtnAtributo.Text = GetLocalResourceObject("Btn_Bod_Clase_Atributo RecursoKCG.Text").ToString();
        BtnAtributo.ToolTip = GetLocalResourceObject("Btn_Bod_Clase_Atributo RecursoKCG.ToolTip").ToString();
    }  
    
    protected void BtnAtributo_Click(object sender, EventArgs e)
    {
        TextBox ClaseId = (TextBox)Fv.FindControl("Id");
        TextBox ClaseCodigo = (TextBox)Fv.FindControl("Codigo");
        TextBox ClaseNombre = (TextBox)Fv.FindControl("Nombre");
        Response.Redirect("~/BOD/BOD_CLASE_ATRIBUTO.aspx?Bod_Clase_Id=" + ClaseId.Text + "&Bod_Clase_Codigo=" + ClaseCodigo.Text + "&Bod_Clase_Nombre=" + ClaseNombre.Text);
    }   
}
